package com.yoyoyo666.report.common;

public enum BugTypeEnum {

    /*
activated 激活
assigned 分配
bugconfirmed 确认
closed 关闭
commented bug 添加备注
deleted 删除
deletedfile 删除文件
edited 编辑
linked2release 发布
opened 创建
resolved 解决
tostory bug 转需求
     */

    activated("activated", "激活", "激活"),
    assigned("assigned", "分配", "分配"),
    bugconfirmed("bugconfirmed", "确认", "确认"),
    closed("closed", "关闭", "关闭"),
    commented("commented", "添加备注", "添加备注"),
    deleted("deleted", "删除", "删除"),
    deletedfile("deletedfile", "删除文件", "删除文件"),
    edited("edited", "编辑", "确认及重现"),
    linked2release("linked2release", "发布", "发布"),
    opened("opened", "创建", "创建"),
    resolved("resolved", "解决", "解决"),
    tostory("tostory", "转需求", "转需求"),
    ;
    private String key;
    private String value;
    private String comment;

    BugTypeEnum(String key, String value, String comment) {
        this.key = key;
        this.value = value;
        this.comment = comment;
    }

    public String getKey() {
        return key;
    }

    public String getValue() {
        return value;
    }

    public String getComment() {
        return comment;
    }


    public static String getBugComment(String key) {
        if (key == null) {
            return null;
        }
        for (BugTypeEnum activityUnitEnum : BugTypeEnum.values()) {
            if (activityUnitEnum.getKey().equals(key)) {
                return activityUnitEnum.getComment();
            }
        }
        return null;
    }

    public static BugTypeEnum getValueByType(String key) {
        if (key == null) {
            return null;
        }
        for (BugTypeEnum activityUnitEnum : BugTypeEnum.values()) {
            if (activityUnitEnum.getKey().equals(key)) {
                return activityUnitEnum;
            }
        }
        return null;
    }
}
